package com.mylove.judas.yaya.mvp.presenter.impl;

import com.mylove.judas.yaya.common.http.ParamPost;
import com.mylove.judas.yaya.common.rx.subscriber.ProgressDialogSubscriber;
import com.mylove.judas.yaya.entity.ImageEntity;
import com.mylove.judas.yaya.mvp.model.MeiTuModel;
import com.mylove.judas.yaya.mvp.presenter.BasePresenter;
import com.mylove.judas.yaya.mvp.presenter.contract.MeiTuContract;
import com.mylove.judas.yaya.ui.App;

import java.util.List;

/**
 * Created by Judas on 2018/4/25.
 */

public class MeiTuPresenter extends BasePresenter<MeiTuModel, MeiTuContract.MeiTuView> {


    public MeiTuPresenter(MeiTuModel mModel, MeiTuContract.MeiTuView mView) {
        super(mModel, mView);
    }

    /**
     * 获取美图列表
     * @param index
     */
    public void getImageAll(int index){

        ParamPost params = ParamPost.build().put("page", index);

        mModel.getImageAll(params, new ProgressDialogSubscriber<List<ImageEntity>>(App.getInstance()) {
            @Override
            public void onNext(List<ImageEntity> list) {
                mView.showListResult(list);
            }

            @Override
            public void onError(Throwable t) {
                super.onError(t);
                mView.showNoData();
            }
        });

    }

}
